package wjh.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import wjh.pojo.Doctor;
import wjh.pojo.Patient;
import wjh.pojo.Register;
import wjh.service.RegisterService;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("/exportRecords")
public class ExportRecordsController {
    @Autowired
    private RegisterService registerService;
    @RequestMapping("/findAllRecords")
    public String findAllRecords(@RequestParam(required = false, defaultValue = "1") Integer pageNum,
                                 @RequestParam(required = false, defaultValue = "3") Integer pageSize,
                                 @RequestParam(required = false) String user_name,
                                 Model model) {
        PageHelper.startPage(pageNum, pageSize);
        List<Register> registerList=registerService.findAllRecords(user_name);
        PageInfo<Register> pageInfo = new PageInfo<>(registerList);
        model.addAttribute("page", pageInfo);
        model.addAttribute("user_name", user_name);
        return "exportRecords";
    }
}
